package dao;

import model.JoinTeamMsg2;
import model.Race;
import model.Team;

import java.util.List;

/**
 * The interface Team dao.
 */
public interface TeamDao {
    /**
     * Insert int.
     *
     * @param team the team
     * @return the int
     */
    int insert(Team team);

    /**
     * Delete int.
     *
     * @param id the id
     * @return the int
     */
    int delete(int id);

    /**
     * Find by id team.
     *
     * @param id the id
     * @return the team
     */
    Team findById(int id);

    /**
     * Find all list.
     *
     * @param pageIndex the page index
     * @param pageSize  the page size
     * @return the list
     */
    List<Team> findAll(int pageIndex, int pageSize);

    /**
     * Page count int.
     *
     * @return the int
     */
    int pageCount(int tid);

    /**
     * Team user add int.
     *
     * @param uid the uid
     * @param tid the tid
     * @return the int
     */
    int teamUserAdd(int uid, int tid);


    int teamDelete(int tid);

    /**
     * Find by part tname list.
     *
     * @param partTname the part tname
     * @param pageIndex the page index
     * @param pageSize  the page size
     * @return the list
     */
    List<Team> findByPartTname(String partTname, int pageIndex, int pageSize);

    public int teamQuite(int tid, int uid);

    List<Team> findTeamListByRace(int rid, int pageIndex, int pageSize);

    int teamListByRaceCount(int rid);

    /**
     * 获取该队伍中的人数
     * @param tid
     * @return
     */
    int getTeamUserCount(int tid);

    List<Team> teamByRaceAndName(int rid, String tname, int pageIndex, int pageSize);

    int teamByRaceAndNameCount(int rid, String tname);

    boolean isInTeam(int uid,int tid,int rid);
    boolean isInTeam2(int uid, int tid);


    /**
     * 根据判断lid和rid判断是否已经组队
     * @param lid
     * @param rid
     * @return 返回 1 表示已经组队，返回0表示未组队
     */
    int teamByIdAndRace(int lid ,int rid);

    List<Team> teamListByUser(int uid, int pageIndex, int pageSize);
    int teamCountByUser(int uid);
    Race raceByTid(int tid);
}